﻿
Public MustInherit Class SubprogramasComunes
    Protected Shared Function AlinearIzquierda(ByVal texto As String, ByVal espacios As Integer) As String
        Dim textoGenerado As String = texto
        If textoGenerado.Length < espacios Then
            While textoGenerado.Length < espacios
                textoGenerado += " "
            End While
        Else
            Return textoGenerado.Substring(0, espacios - 4) & "... "
        End If
        Return textoGenerado
    End Function

    Protected Shared Function AlinearDerecha(ByVal texto As String, ByVal espacios As Integer) As String
        Dim textoGenerado As String = texto
        While textoGenerado.Length < espacios
            textoGenerado = " " & textoGenerado
        End While
        Return textoGenerado
    End Function

    Protected Shared Function GetExtension(ByVal path As String) As String
        Dim extension As String = IO.Path.GetExtension(path)
        If extension = "" Then Return "NO-EXTENSION"
        Return extension
    End Function

    Protected Shared Function GetNombre(ByVal path As String) As String
        Dim generado As String = ""
        Dim splitted() As String = Split(My.Computer.FileSystem.GetName(path), ".")
        For i As Integer = 0 To splitted.Length - 2
            generado = generado & splitted(i)
        Next
        Return generado
    End Function
End Class
